package com.xpresso.utils.image;

import java.util.HashMap;

public class ExifHelper {

	public HashMap<String, String> getExifTag(String exifInfo){
		// TODO: This method is not complete !
		// We need to still finish it...
		
		if (exifInfo == null){
			return null;
		}
		HashMap<String, String> tags = new HashMap<String, String>();
		String[] tagArray = exifInfo.split("?");
		for (String pTag:tagArray){
			System.out.println(pTag + "!!!!!!!!!!!!!");
		}
		
		return tags;
	}
	
	public String getExifTag(String exifInfo, String tagName){
		if (exifInfo == null){
			return null;
		}
		String value = null;
		int tagPosition = exifInfo.indexOf(tagName);
		if (tagPosition > -1){
			int nextTagPos = exifInfo.indexOf("[", tagPosition +1);
			if (nextTagPos < 0){
				nextTagPos = exifInfo.length();
			}
			value = exifInfo.substring(tagPosition + tagName.length() + 3, nextTagPos -1);
		}
		
		return value;
	}
	
}
